let app=getApp;
Page({
  data: {
    swipers: [
      {
        url: "/images/index/swiper/1.jpg"
      }, {
        url: "/images/index/swiper/2.jpg"
      }, {
        url: "/images/index/swiper/3.jpg"
      }, {
        url: "/images/index/swiper/4.jpg"
      }, {
        url: "/images/index/swiper/5.jpg"
      }
    ],

    article: [
 
    ]
  },

  navigateToPage(e) {
    let url = '';
    const page = e.currentTarget.dataset.page;

    switch (page) {
      case 'psychTest':
        url = "/pages/index/psychology/assessment/assessment"
        break;
      case 'appointment':
        url = "/pages/index/appointment/appointment";
        break;
      case 'qa':
        url = "/pages/index/psychology/qa/qa";
        break;
      case 'knowledge':
        url = "/pages/index/psychology/knowlege/knowlege"
        break;
      case 'fm':
        url = "/pages/index/fm/fm"
        break;
      case 'common':
        url = "/pages/index/welfare/welfare"
        break;
      case "search":
        console.log(e);
        url = "/pages/index/search/search"
        break;
      default:
        break;
    }

    wx.navigateTo({
      url: url,
    })
  },


  onLoad(options){
    wx.request({
      url: 'http://localhost:8080/article/getAllArticles?pageNum=1&pageSize=2',
      success:(res)=>{
        console.log(res.data.data.list);
        this.setData({
          article:res.data.data.list
        })
      }
    })


  },

  publishQuestion() {
    let url = "/pages/index/psychology/qa/publish/publish";
    wx.navigateTo({
      url: url,
    })
  },


  transDetail(e){
    wx.navigateTo({
      url: '/pages/index/articledetail/articleDetail?id='+e.currentTarget.dataset.id,
    })
  },
  checkmorearticle(){
    wx.navigateTo({
      url: '/pages/index/articleList/articleList',
    })
  }
})